<?php

require_once(WSB_MODULES_PATH . 'sherpa/models/DbTable/Color.php');

class Sherpa_ColorsController extends WSB_Controller_Action
{

	public function init()
	{
		parent::init(); // immer zuerst!
	    $this->_models = array('Sherpa_Model_DbTable_Color');
		Zend_Layout::getMvcInstance()->setLayout('layout');
	}

	/**
	 * Kein Hinzufuegen-Link
	 *
	 * @return string
	 */
	public function getDefaultAddUrl()
	{
		return '';
	}

    /**
     * Nur das Icon Ansehen einblenden
     *
     * @param WSB_Db_Row $model
     * @param integer $modelIndex
     * @return array
     */
	public function buildListItemHtmlLinks(WSB_Db_Row $model, $modelIndex=0)
	{
		$links = array();
		array_push($links, $this->_buildViewListItemHtmlLink($model, $modelIndex));
		return $links;
	}

	/**
	 * @param array $filter
	 * @return array
	 */
	protected function _buildWhereStatement(array $filter)
	{
		$where = array();
	    if(key_exists('key', $filter) && ($filter['key'] != '')) {
	        if(key_exists('value', $filter) && ($filter['value'] != '')) {
	        	$where[$filter['key'] . ' LIKE ?'] = '%'.$filter['value'].'%';
	        }
	    }
	    return $where;
	}

}
